//
//  NormalMessageCell.m
//  CarTown
//
//  Created by xionghao on 15/8/15.
//  Copyright (c) 2015年 熊浩. All rights reserved.
//

#import "NormalMessageCell.h"
#import "MessageFrame.h"
#import "MessageModel.h"
@implementation NormalMessageCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self=[super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.icon=[[UIButton alloc]init];
        
        [self.contentView addSubview:self.icon];
        self.username=[[UILabel alloc]init];
        self.username.textAlignment=NSTextAlignmentCenter;
        [self.contentView addSubview:self.username];
        
        self.time=[[UILabel alloc]init];
        [self.contentView addSubview:self.time];
        self.content =[[UIButton alloc]init];
        [self.contentView addSubview:self.content];
    }
    return self;
}

- (void)awakeFromNib {
    // Initialization code
}
-(void)setMessageframe:(MessageFrame *)messageframe{
    _messageframe=messageframe;
    self.icon.frame=messageframe.iconf;
    [self.icon setBackgroundColor:UIColorWithRGB(4, 4, 4)];
    self.username.frame=messageframe.namef;
    self.username.text=messageframe.message.username;
    self.username.font=[UIFont systemFontOfSize:12];
    self.time.frame=messageframe.timef;
    self.time.text=@"12:30";
    self.content.frame=messageframe.contentf;
    self.content.titleLabel.font=[UIFont systemFontOfSize:14];
    self.content.titleLabel.numberOfLines=0;
    [self.content setTitle:messageframe.message.detail forState:UIControlStateNormal];
    if (messageframe.message.receType==MessageReceiveType) {
//        [self.content setBackgroundImage:[UIImage imageWithStretchableName:@"message_hui"] forState:UIControlStateNormal];
        [self.content setBackgroundColor:[UIColor blackColor]];
        
    }else{
//        [self.content setBackgroundImage:[UIImage imageWithStretchableName:@"message_blue"] forState:UIControlStateNormal];
         [self.content setBackgroundColor:[UIColor blueColor]];
    }
    
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}



@end
